/*
 * @lc app=leetcode.cn id=2656 lang=csharp
 *
 * [2656] K 个元素的最大和
 */

// @lc code=start
public class Solution {
    public int MaximizeSum(int[] nums, int k) {
        int max = 0;
        for (int i = 0; i < nums.Length; i++)
        {
            if( max < nums[i])
                max = nums[i];
        }
        
        return k * (max + max + k - 1) / 2;
    }
}
// @lc code=end

